package org.student.impl;

import java.util.List;

import org.springframework.stereotype.Component;
import org.student.dao.ISubjectArrangeDao;
import org.student.entity.StuSys_Arrange;
import org.student.entity.StuSys_ClassInfo;
import org.student.entity.StuSys_Subject;
import org.student.entity.StuSys_SubjectArrange;
import org.student.entity.StuSys_Teacher;

@SuppressWarnings("all")
@Component("SubjectArrangeDaoImpl")
public class SubjectArrangeDaoImpl extends HibernateDaoImpl implements ISubjectArrangeDao{

	/**
	 * 
	 * @param subjectArrange
	 * @throws Exception
	 */
	@Override
	public void subArrangeInfoSave(StuSys_SubjectArrange subjectArrange)
			throws Exception {
		super.save(subjectArrange) ;
		
	}

	/**
	 * 
	 * @param subjectArrange
	 * @throws Exception
	 */
	@Override
	public List<StuSys_Arrange> getAllArranges() throws Exception {
		return super.findAll(StuSys_Arrange.class) ;
	}

	/**
	 * 
	 * @param subjectArrange
	 * @throws Exception
	 */
	@Override
	public List<StuSys_ClassInfo> getAllClassInfos() throws Exception {
		return super.findAll(StuSys_ClassInfo.class) ;
	}

	/**
	 * 
	 * @param subjectArrange
	 * @throws Exception
	 */
	@Override
	public List<StuSys_Subject> getAllSubjects() throws Exception {
		return super.findAll(StuSys_Subject.class) ;
	}

	/**
	 * 
	 * @param subjectArrange
	 * @throws Exception
	 */
	@Override
	public List<StuSys_Teacher> getAllTeachers() throws Exception {
		return super.findAll(StuSys_Teacher.class) ;
	}

	@Override
	public List<StuSys_SubjectArrange> getSubjects() throws Exception {
		return this.find("FROM StuSys_SubjectArrange") ;
	}

	@Override
	public void deleteSubjectById(int id) throws Exception {
		this.delete(StuSys_SubjectArrange.class, id) ;
	}

	@Override
	public StuSys_SubjectArrange getSubjectById(int id) throws Exception {
		return (StuSys_SubjectArrange)this.get(StuSys_SubjectArrange.class, id);
	}

	@Override
	public List<StuSys_SubjectArrange> getSubjectByKeyWord(String keyWord)
			throws Exception {
		String hql = "FROM StuSys_SubjectArrange "
					+ "WHERE teachName LIKE '%"+keyWord+"%' "
					+ "OR className LIKE '%"+keyWord+"%' "
					+ "OR classRoom LIKE '%"+keyWord+"%' "
					+ "OR subName LIKE '%"+keyWord+"%' " ;
		return this.find(hql) ;
	}


}
